import request from '@/utils/request'

// 查询请假申请列表
export function listLeaveApply(query) {
  return request({
    url: '/bd/function/leaveapply/list',
    method: 'get',
    params: query
  })
}

// 查询部门领导列表
export function listDeptLeader(query) {
  return request({
    url: '/bd/function/leaveapply/leader_list',
    method: 'get',
    params: query
  })
}
// 获取登录者姓名
export function getLoginer() {
  return request({
    url: '/bd/function/leaveapply/getName' ,
    method: 'get'
  })
}

// 新增请假
export function addLeaveApply(data) {
  return request({
    url: '/bd/function/leaveapply/add',
    method: 'post',
    data: data
  })
}

// 查询请假详细
export function getLeaveApply(id) {
  return request({
    url: '/bd/function/leaveapply/' + id,
    method: 'get'
  })
}
//销假
export function destroyApply(data) {
  return request({
    url: '/bd/function/task/completeTask',
    method: 'post',
    data: data
  })
}
//调整申请
export function reApply(data) {
  return request({
    url: '/bd/function/task/completeTask',
    method: 'post',
    data: data
  })
}
//撤销按钮
export function applyRevoke(task_id){
  return request({
    url: '/bd/function/leaveapply/forceEnd/' + task_id,
    method: 'get'
  })
}
//驳回按钮
/* export function applyReject(task_id){
  return request({
    url: '/bd/function/leaveapply/jump/' + task_id,
    method: 'get'
  })
} */
//根据id查看请假
export function getLeaveApplyById(id){
  return request({
    url: '/bd/function/leaveapply/get/' + id,
    method: 'get'
  })
}
// 修改请假
export function updateLeaveApply(data) {
  return request({
    url: '/bd/function/leaveapply/update',
    method: 'put',
    data: data
  })
}

// 删除请假
export function delLeaveApply(id) {
  return request({
    url: '/bd/function/leaveapply/' + id,
    method: 'delete'
  })
}
